Current Location: Home> Function Categories> rand

rand

Generate a random integer
Name:rand
Category:math
Programming Language:php
One-line Description:Returns a random integer.

Definition and usage

rand() function returns a random integer.

Example

This example returns some random numbers:

 <?php
echo ( rand ( ) ;
echo ( rand ( ) ;
echo ( rand ( 10 , 100 ) )
?>

Try it yourself

grammar

 rand ( min , max )
parameter describe
min , max Optional. Specifies the range of random numbers generated.

illustrate

If no optional parameters min and max are provided, rand() returns a pseudo-random integer between 0 and RAND_MAX. For example, if you want a random number between 5 and 15 (including 5 and 15), use rand(5, 15) .

Similar Functions
Popular Articles